package com.zmovie.framework.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zmovie.framework.domain.MovieRate;
import com.zmovie.framework.domain.dto.MovieRateDTO;
import com.zmovie.framework.service.MovieRateService;
import com.zmovie.framework.mapper.MovieRateMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author lenovo
* @description 针对表【movie_rate】的数据库操作Service实现
* @createDate 2023-11-30 12:27:42
*/
@Service
public class MovieRateServiceImpl extends ServiceImpl<MovieRateMapper, MovieRate>
    implements MovieRateService{
    @Autowired
    private MovieRateMapper movieRateMapper;
    @Override
    public List<MovieRateDTO> listTop(Integer cnt) {
        return movieRateMapper.listTop(cnt);
    }

    @Override
    public MovieRate getByMovieId(Integer movieId) {
        LambdaQueryWrapper<MovieRate> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(MovieRate::getMovieId, movieId);
        return getOne(wrapper);
    }
}




